<template>
    <div class="topNav">
        <div class="topleft">
            <svg class="icon" aria-hidden="true">
                <use xlink:href="#icon-caidan"></use>
            </svg>
        </div>

        <div class="topContent">
            <span>我的</span>
            <span @click="toHome" :class="{ active: findlight }">发现</span>
            <span>云村</span>
            <span @click="toVideo" :class="{ active: videolight }">视频</span>
        </div>
        <div class="topRight" @click="toSearch">
            <svg class="icon" aria-hidden="true">
                <use xlink:href="#icon-sousuo"></use>
            </svg>
        </div>
    </div>
</template>

<script>
export default {
    name: "TopNav",
    data() {
        return {};
    },
    methods: {
        toSearch() {
            this.$router.push("/search");
        },
        toVideo() {
            this.$router.push("/video");
        },
        toHome() {
            this.$router.push("/");
        },
    },
    computed: {
        videolight() {
            return this.$route.path === "/video";
        },
        findlight() {
            return this.$route.path === "/";
        }, 
    },
    mounted() {
        console.log();
    },
};
</script>

<style lang="less">
.topNav {
    width: 100%;
    height: 1rem;
    padding: 0.2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    .topContent {
        width: 65%;
        height: 100%;
        display: flex;
        justify-content: space-around;
        // align-items: center;
        font-size: 0.36rem;
        .active {
            font-weight: 900;
        }
    }
}
</style>